#pragma once

#include <QString>
#include <QSharedPointer>
#include <QVector>
#include "ParametersBean.h"
#include "Messaging.h"


class Command
{
public:

    enum DirectionType
    {
        eNorth,
        eSouth,
        eEast,
        eWest
    };

    enum TurnType
    {
        eTurnLeft,
        eTurnRight
    };

    enum CommandType
    {
        eReqSendNickname = 0,
        eReqDisconnect,
        eReqFire,
        eReqMove,
        eReqTurn,
        eReqTurnLeft,
        eReqTurnRight,
        eReqStopMove,
        eReqStopFire,

        eActConnAccepted,
        eActConnRejected,
        eActPlayerlist,
        eActGameStart,
        eActGameEnd,
        eActSendSnapshot,
        eActSendMap,
        eActMove,
        eActFire,
        eActTurn,
        eActStopMove,
        eActStopFire,

        aReqPlayerlist,

        eUnknown = -1
    };

    Command(CommandType cmdType = eUnknown,
            ParametersBean* commandData = new ParametersBean()) :
        m_commandType(cmdType), m_data(ParametersPtr(commandData))
    {}

    ~Command() {}

    inline CommandType Type() const { return m_commandType; }
    void SetType(CommandType newType) { m_commandType = newType; }

    inline ParametersPtr Params() const { return m_data; }

private:
    ParametersPtr m_data;
    CommandType m_commandType;
};

class NullCommand : public Command
{
public:
    NullCommand() :
        Command()
    {}
};

typedef QSharedPointer<Command> CommandPtr;
